package br.com.news.web.service;

import javax.ws.rs.core.MediaType;

import br.com.news.utils.database.beans.FonteBean;

import com.google.gson.Gson;
import com.sun.jersey.api.client.Client;

public class FonteService {

	public FonteBean buscaPorNome(FonteBean fonteBean) {
		Gson g = new Gson();
		String json = g.toJson(fonteBean);
		Client c = Client.create();
		String respostaJson = c.resource("http://localhost:8080/news-web-service-rest/fontes/buscapornome").accept(MediaType.APPLICATION_JSON)
				.type(MediaType.APPLICATION_JSON).post(String.class, json);
		fonteBean = g.fromJson(respostaJson, FonteBean.class);
		return fonteBean;
	}
	
}
